// dsegen.cpp : Defines the exported functions for the DLL application.
//

#include "stdafx.h"
#include "dsegen.h"
#include "HRTimer.h"
#include "BlockDesign.h"
#include "PathInfo.h"


namespace dhis
{

	//------------------------------------------------------------------------------
	static REAL _getDataValue2(void* data,const int& xsize,const int& band,const GDALDataType& type,const int& x)
	{
		REAL val = 0.0;
		switch (type)
		{
		case GDT_Byte:
			{
				unsigned char* pData = (unsigned char*)(data);
				unsigned char myval = pData[band*xsize+x];
				val = (REAL)(myval);
			}
			break;
		case GDT_UInt16:
			{
				unsigned short* pData = (unsigned short*)(data);
				unsigned short myval = pData[band*xsize+x];
				val = (REAL)(myval);
			}
			break;
		case GDT_Int16:
			{
				short* pData = (short*)(data);
				short myval = pData[band*xsize+x];
				val = (REAL)(myval);
			}
			break;
		case GDT_UInt32:
			{
				unsigned int* pData = (unsigned int*)(data);
				unsigned int myval = pData[band*xsize+x];
				val = (REAL)(myval);
			}
			break;
		case GDT_Int32:
			{
				int* pData = (int*)(data);
				int myval = pData[band*xsize+x];
				val = (REAL)(myval);
			}
			break;
		case GDT_Float32:
			{
				float* pData = (float*)(data);
				float myval = pData[band*xsize+x];
				val = (REAL)(myval);
			}
			break;
		case GDT_Float64:
			{
				REAL* pData = (REAL*)(data);
				REAL myval = pData[band*xsize+x];
				val = (REAL)(myval);
			}
			break;
		default:
			std::cerr << "the gdal data type can't supported!" << std::endl;
			break;
		}
		return val;
	}

}



